﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class ShowAllRegisterModules : System.Web.UI.Page
{
    private string ShowModules() {
        HttpApplication app = Context.ApplicationInstance; //获取当前上下文的HttpApplication环境
        HttpModuleCollection moduleCollection = app.Modules; //获取所有Module集合

        // 获取所有的 Module 名称
        string[] moduleNames = moduleCollection.AllKeys;

        System.Text.StringBuilder results = new System.Text.StringBuilder();    //遍历结果集

        foreach (string name in moduleNames) 
        {
           // 获得Module名称
           results.Append("<b style='color:#800800'>名称：" + name + "</b><br />");
            // 获得Module类型
           results.Append("类型：" + moduleCollection[name].ToString() + "<br />"); 
        }

        return results.ToString();
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write(ShowModules());
    }

}
